package com.xuetang9.t9.xinhuaxia.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
//    public static String app_id = "2016101800716568";

    // 商户私钥，您的PKCS8格式RSA2私钥
//    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYuA2w79i+bMb85Y+0mopkTjDYEODYrfTSFtuJGX58uit9ARsNwODKej0VnbMER2I+mqzFnPSHooZo1R3c5GdgM+/TnEqASxp5JmESqwwsI0AvxjPAT10brSNVTIjcQnDua9YJFstVBSg5G4lFjBdnmWbgKxUx71qJLBU/jBD7mxIijscgH9+fgtLObMtgvdfggDipBbr0xON+YfoUaiUTrzqgXoxMz0rVKy5CsiFsfVlMMmwxuRBLjt03OYFKVnig+2ZYky28xk4g0OrhJmI+o4WMdk91BoinhJ4kZl/a45rv7uR75yrruY2AJy8W6+2ihn2Jn86Q41GLEvLjZoInAgMBAAECggEAPD6XAA6NpQkKMmdomilAoLMLp6B44mE1K89iiSHqeM+EKkrOXk2RH666/BT6spxqUCH6N/ZjrEHb3ez8W9AqS5QRbpu/8/4sklAmiRO6uIqrXm1Eqv9jznAteQ+5CZKYNCWMCIfabE6dgHGxZCMQdIjaQWIdeVZfk681Lp1VcbsrEb1j4SfhC2cea/dXBeiSp6OsnTCa//5GkS6jVWFGVSaFB22gXPbPK3GsVvNkRpv2FAj/fcZbVgHWlXbCd9qye5PlFWQWVeOu9WnjLJYMGrI0FUXXZLuY5nfZ21PHy9Bk+RI0D6rwn/pdt9fWocXy3MaeqkY4zdmR8jwzJOppyQKBgQDsvWt47EJmr1xmeT/RHBT+mXB8jgQteV/bHNq5wU9z+nMeybWFRb9KXSAmriOp2hT9drxpalCaLBogSpdwhDtYDt2IBmwjHcIU77yMFrbjsI3kJCsNXrIlDYwFE6+5XbEPOSwfuVuixDgzMgo5nN2KPmM52mXx9T0YTCYaP+YqxQKBgQClJLrXeHWqkyC2HNrMw/IW21zPfscgz1ywiNkCFGDKuJnuAw4SKWGxcoTtVV0c0ZxUB+5yAwzV+NN3RQu96Bu30DWRTyP8BAcs/ccydEZaofH0jQqj3XtHRVH2JMTWwY9XP22rFcCxi8tTIkfevEQcZ8v5AOt3OqyIhjWQVQV3+wKBgCQQt060r2j1Th5OWmqA3LHsrjZLbFeBJhk7TBcAXBpPDTqjgAPNnFa32S4LWWOG1avHauykRaM3FMPWmTuK6X+AxD70u4SeA/MskozE6RfGzdbzq5td0cXTSoF7fkm+/DpVe2NZ2ZvySJ2EAgrE2vs0helKXD2AHs6Uyzk0gtwBAoGAUGX7WJ9ambqbOE3/76SNnbcaDiKoiz6o34EgNTT6kncg6ZEvLoRa/WrFcE4Y0MjzlK1v1q3Jd/p16SECQGhZ5jlFewLOgAjt/WdnrRaSkdk51Fc+ENzpAZ+r8WuhMPR29oD4wUwLzeRDDqwn1TZO6o1V7loWSKuWB7lfJm9eBDUCgYEA1ezx/eQv86kaF8I6SZnj78HYQgq/6w+f/k4swzp/XP5X5AzHDSMZuTz+9klulz4y94YGVpCgPcMHQTVr0y0dSSee6W/niiYH1mtKyXsOmytTcb1wTaLyYcnvnaFzWVwoWIJsAxI6rGThCDnaJMtRcgsqRIT72NlRpctWcFuSAOQ=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
//    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiicJKJJRafQu7lJz+EhSrGP0ape7cJmrMgCncqiHaBS3jEvduMvZ5WDOvVdpso0tyo2xyYk+Olj3Amc0zaEtISLu4aWbCcqb74Hoa3WFpDzYfsCwVDP2+M28pbpS9yCY9sUK+b11P3h7ORipWh4FhW4L0CSfFeFn1Q636iVz8F919ASlUdVi8QOOUQy28W+CkSN1ENK8pD9SqvRw8ov84ulA/JLokBBXFInKiM2oNy+BXWlE2cRMaNobYabas2kr5/+SiOaYGu3zp7u01fRT+pTAuqVxYaHQDl2NOVzvbD+a31EdTIBLX1GhoIPGZOOoCwASkFSUI3SnbZ934o4IbwIDAQAB";

    public static String app_id = "2016101800718027";
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1KWS3gAwkR0+kZafswtxljNLfcgAamKEl8sdyP5ZQdphZHmG7Ufr4OJkRzdrwmqcBG81qIpQe8aGSb6ZL+CAQFXSrUT/CiiORSgsOygJQ9/EdjM/qtoT7TBNVcDrT75CCkiitsYmd7kCqZhbQD9gsPZayu6KwSiJgXwW+25HuFxGmOffAJzBLbqknmxzUHBDb3xUlJcb8GyD9egSOr4IphSpcD8iWPJJRb7vP1d87RlivHuwW3TdhDojb4T0Q+ym+1LYqGxYuDh2HVA78xec511S3PpBlf3enp6AsPBR1Nuk1v1idKZMFZgwQ8RJYJXlfkBLBaZxD+EiYgpS+wnmlAgMBAAECggEAdmvQgoMZbL2Qug4ZbxMRrvAXCCklGD2dWYkSBwS55W8gt2C80g4M2CVnKdQ+wfjWIktiQ3bHDFM3ItoJAq/3hYwA79v0qd5S0a5s/AXg7bylyIM7hlo5I2vfV4I9cjyvYirYnHHpW2taqgiB8Q/qZ0D7OWqeNk6/me+DefddtRwVOfZDqRQ48JU81D9LPl+Hj0B3XtD3SNnFcEYkzvECCf6ejlWKWtzv1N8mgCNe2nc6uL27R3D6vmiBjZSBjs02CZSRRME8obNbR27uFBk59oM5c2S5h5qUHAQrF4madYtLqCTh9wEUuqmZ0DsRdYDmR15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4zp/97x5O9tH3jl9FYDWb2c0Ce4IOJkYIcc2wIx/Q9sIrNiVsMChPHozy1gjz8AtyHZDrTm8tNY+VRr0F6k4Rt5YQuqfFqhndPOeVIuP8Y48B0k5KHJWYSgCghcQg52iMqy5bHrk1Bq+0SsCqkWvZWckJ25r+eumijflkmRCPaSgWVRohhW3Pu6G9DSYFxBMQ+FgrHoxAqUDpUergxyR7r08Wtq3MIF0gHRwolxGdXEgkTuXQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//    public static String notify_url = "http://192.168.1.108:80/#/OrderConfirm/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    public static String notify_url = "http://localhost/#/Alipay";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//    public static String return_url = "http://192.168.1.108:90/return_url.jsp";
    public static String return_url = "http://192.168.1.108:80/#/OrderSubmission";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

